﻿Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Data.Sql
Imports Seuss.EnterpriseLibrary.Cryptograph
Imports Seuss.EnterpriseLibrary.DataAccess
Imports Seuss.EnterpriseLibrary.BusinessLogic
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Configuration

Partial Class Consulta_Perfil
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim UserCodigo As String = IdentityUser.UserCode
            Dim ldr As New List(Of IDataReader)
            Dim DivPrincipal As New StringBuilder
            Dim PerfilAlumno As Boolean = False
            Dim PerfilDocente As Boolean = False
            Dim PerfilAdmin As Boolean = False
            Dim PerfilPadre As Boolean = False

            Using ObjPool As New PoolDbCommand()
                Dim ObjUsuario As New DAL_Kiosco(ObjPool.Database)
                ObjPool.AddDbCommand(ObjUsuario.Get_Perfiles_By_cPerCodigo(UserCodigo, "21111"), PoolDbCommand.PoolDbCommandResultType.Query)
                ObjPool.Pooling(Nothing, ldr, True)                
                If ldr(0).Read() Then
                    PerfilAlumno = ldr(0).GetString(0)
                    PerfilDocente = ldr(0).GetString(1)
                    PerfilAdmin = ldr(0).GetString(2)
                    PerfilPadre = ldr(0).GetString(3)
                End If
                ObjUsuario = Nothing
            End Using

            DivPrincipal.Append("<div class=""listview"">")
            DivPrincipal.Append("<ul>")
            If PerfilAlumno Then
                Session("PerfilAlumno") = True
                DivPrincipal.Append("<li><a href='./Alumno.aspx'>Alumno<span></span></a></li>")
            End If
            If PerfilPadre Then
                Session("PerfilPadre") = True
                DivPrincipal.Append("<li><a href='./Padre.aspx'>Padre<span></span></a></li>")
            End If
            If PerfilDocente Then
                Session("PerfilDocente") = True
                DivPrincipal.Append("<li><a href='./Docente.aspx'>Docente<span></span></a></li>")
            End If
            If PerfilAdmin Then
                Session("PerfilAdmin") = True
                DivPrincipal.Append("<li><a href='./Administrativo.aspx'>Administrativo<span></span></a></li>")
            End If            
            DivPrincipal.Append("</ul>")
            'DivPrincipal.Append("<span class=""Regresar""><a href=""javascript:window.history.go(-1);"">Regresar</a></span>")
            DivPrincipal.Append("</div>")

            lblPerfil.Text = DivPrincipal.ToString
            Using Seguridad As New BLL_Administracion
                Seguridad.Set_Transaccion_Insert(Nothing, 100401, IdentityUser.UserCode, My.Request.UserHostAddress.ToString, CrearXMLTransaccion("Consulta Pagina Movil", "/Pagina|" + My.Request.Url.Segments(My.Request.Url.Segments.Length - 1).ToString))
            End Using
        End If
    End Sub
End Class
